import {createRouter, createWebHashHistory} from 'vue-router'
import HomeView from '@/views/HomeView.vue'
import SearchView from '@/views/SearchView.vue'

const routes = [
  // 动态传参:words  这里直接跳转搜索页会导致报错找不到/search，因此需要将携带参数变为可选:words?
  {path: '/home', component: HomeView},
  {path: '/search/:words?', component: SearchView}
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router